﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProtoBuf;

namespace PnJ.Aliyun.OTS.Models
{
    /// <summary>
    /// 
    /// </summary>
    [ProtoContract(Name = "UpdateRowRequest")]
    public class UpdateRowRequest
    {
        public UpdateRowRequest()
        {

        }
        public UpdateRowRequest(string tableName,Condition condition,List<Column> primaryKey,List<ColumnUpdate> attributeColumns)
        {
            this.TableName = tableName;
            this.Condition = condition;
            this.PrimaryKey = primaryKey;
            this.AttributeColumns = attributeColumns;
        
        }
        private List<Column> primaryKey = new List<Column>();
        private List<ColumnUpdate> attributeColumns = new List<ColumnUpdate>();
        /// <summary>
        /// 请求更新数据的表名
        /// </summary>
        [ProtoMember(1, Name = "table_name", IsRequired = true)]
        public string TableName { get; set; }
        /// <summary>
        /// 在数据更新前是否进行存在性检查
        /// </summary>
        [ProtoMember(2, Name = "condition", IsRequired = true)]
        public Condition Condition { get; set; }
        /// <summary>
        /// 请求更新的行全部的主键列
        /// </summary>
        [ProtoMember(3, Name = "primary_key", IsRequired = true)]
        public List<Column> PrimaryKey { get { return primaryKey; } set { primaryKey = value; } }
        /// <summary>
        /// 该行本次想要更新的全部属性列
        /// </summary>
        [ProtoMember(4, Name = "attribute_columns", IsRequired = true)]
        public List<ColumnUpdate> AttributeColumns { get { return attributeColumns; } set { attributeColumns = value; } }
    }
}